package ar.edu.unq.leezsi.html;

import javax.servlet.http.HttpServletResponse;

import ar.edu.unq.leezsi.utils.ResponseWriter;

public abstract class SelfClosedTag<T> extends Component<T> {

	protected abstract Object modelPorperty();

	@Override
	protected void renderOn(HttpServletResponse response) {
		ResponseWriter responseWriter = new ResponseWriter(response);
		this.configureResponse(responseWriter);
		this.doOnBeforeRenderer();
		StringBuilder tag = new StringBuilder();
		tag.append("<").append(this.tag()).append(" ")
				.append(this.attributes()).append(this.modelPorperty())
				.append("=\"").append(this.getModel().toString()).append("\"")
				.append(" />\n");
		responseWriter.write(tag.toString());
		this.onAfterRenderer();
	}

}
